#include <iostream>
#include <vector>
using namespace std;

// 线段
struct line {
    int x1;
    int y1;
    int x2;
    int y2;
public:
    line(int x1, int y1, int x2, int y2) {
        this->x1 = x1;
        this->x2 = x2;
        this->y1 = y1;
        this->y2 = y2;
    }
    line returnVerticleLine() {
        line result(y2, x1, y1, x2);
        return result;
    }
};

int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }

// 求原点到指定点向量对指定过原点投影轴投影长
int castPoint(int x1, int y1, line l) {
    return x1 * (l.x2 - l.x1) + y1 * (l.y2 - l.y1);
}

// 关于某直线的投影是否重合
bool isProjectCollision(line l1, line l2, line castLine) {
    int minCastVal, maxCastVal;
    int point1Min = min(castPoint(l1.x1, l1.y1, castLine), castPoint(l1.x2, l1.y2, castLine));
    int point1Max = max(castPoint(l1.x1, l1.y1, castLine), castPoint(l1.x2, l1.y2, castLine));
    int point2Min = min(castPoint(l2.x1, l2.y1, castLine), castPoint(l2.x2, l2.y2, castLine));
    int point2Max = max(castPoint(l2.x1, l2.y1, castLine), castPoint(l2.x2, l2.y2, castLine));
    // 以此为依据来判断投影线段的位置，是否重合
    int minAll = min(point1Min, point2Min);
    int maxAll = max(point1Max, point2Max);
    return point1Max - point1Min + point2Max - point2Min >= maxAll - minAll;
    // 如果两条投影线段中间有空隙，总线段长度大于二线段之和，否则，二线段有相交部分
}

bool isCollision(line l1, line l2) {
    // 使用SAT投影法，仅需将两条线段和它们的垂线做投影轴即可
    return isProjectCollision(l1, l2, l1) && isProjectCollision(l1, l2, l2) &&
    isProjectCollision(l1, l2, l1.returnVerticleLine()) && isProjectCollision(l1, l2, l2.returnVerticleLine());
}

int main() {
    int times;
    cin >> times;
    vector<line> lines;
    for (int i = 0; i < times; i++) {
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        line curr(x1, y1, x2, y2);
        lines.push_back(curr);
    }
    int totalCnt = 0;
    for (int j = 0; j < lines.size(); j++) {
        for (int k = j + 1; k < lines.size(); k++) {
            if (isCollision(lines[j], lines[k])) {
                cout << "X: #" << j + 1 << " #" << k + 1 << endl;
                totalCnt++;
            }
        }
    }
    cout << "n=" << totalCnt << endl;
    return 0;
}